Functions¶
-
Aduct.
add_to_notebook
(element, notebook, position=-1)¶ Adds an element to the notebook at given position.
When the given
element
is already a child of some container, the function removes it from the parent and adds thenotebook
to parent. Then the orphanelement
is added tonotebook
atposition
.Parameters: Raises:
-
Aduct.
add_to_paned
(child1, child2, paned, position)¶ Adds the children to given paned determined by position.
The main child
child1
is added at first panel ifposition
is 1 or second panel ifposition
is 2. With respect to position ofchild1
,child2
is added at the complement panel. Whenposition
is neither 1 nor 2, nothing is done. Ifchild1
is already a child of parent, it is removed from the parent andpaned
is added back in its position. Then, the orphanschild1
andchild2
are added at requred places.Parameters: - child1 (
Gtk.Widget
) – The main child which has to be added at givenposition
. - child2 (
Gtk.Widget
) – The other child which has to be added at the complement of givenposition
. It has to be an orphan. - paned (
Paned
) – The paned to which the children has to be added. - position (
int
) – An integer value that is either 1 or 2. The complement of 1 is 2 and vice-versa.
- child1 (
-
Aduct.
add_to_view
(child, view)¶ Adds a child to the view.
If
child
is not an orphan, it is removed from its parent andview
is added back in its place. Thenchild
is added toview
.Parameters: - child (
Gtk.Widget
or Aduct.Element.Element) – The child that has to be added toview
. It has to be an orphan. - view (
View
) – The view to whichchild
has to be added.
Warning
This function is given as a fall-back case and should never be used blindly without knowing the properties of
child
andview
. When theview
already has a child or requires more information about adding it, exceptions are raised. Still, theview
may try its best to add thechild
at the possible place, only when it can.Incase of
view
being aNotebook
, it appends thechild
to the last position. But it requireschild
to be aElement
. So at either case, you still have limitations that may end up in a weird result. For the same reasons,child
has to be an orphan.- child (
-
Aduct.
change_child_at_element
(element, provider, child_name)¶ Changes the child at given element with a child of given name provided by provider.
The previous child at
element
is cleared, after which the new child is added.Parameters:
-
Aduct.
get_interface
(top_level)¶ Gets the interface starting from the given top level.
Parameters: top_level ( View
) – A view which acts as the root widget.Returns: A dictionary with properties to build interface. Return type: dict
-
Aduct.
remove_element
(element, view)¶ Removes the given element from view.
When
view
is aBin
, it clearselement
. For other types of views, it removeselement
. Then, if the number of children inview
is one, it replacesview
with the other child ofview
.Parameters:
-
Aduct.
replace_child
(view, child1, child2)¶ Replaces the given child of a view with another child.
Parameters: - view (
View
) – The view whose child has to be replaced. - child1 (
Gtk.Widget
) – The child of given view which has to be replaced. - child2 (
Gtk.Widget
) – The child which replaces child1 inview
.
Raises: - view (
-
Aduct.
set_interface
(interface_dict, top_level, creator_maps, init_maps)¶ Sets the interface starting from given the top level.
Parameters: - interface_dict (
dict
) – A dictionary that can be used to set interface. - top_level (
View
) – The root widget from which the interface has to be set. - creator_maps (
dict
) – A dictionary of format{key: (func, args, kwargs)}
, that is used to create the required object. The object is then created usingfunc(*args, **kwargs)
and is substitued as value ininterface_dict
which has keykey
. - init_maps (
dict
) – A dictionary of format{key: object}
already initialized objects. The occurences ofkey
ininerface_dict
is then replaced withobject
.
Returns: The widget that was previous child of
top_level
,None
iftop_level
has no child.Return type: - interface_dict (